package com.baozun.houji.order.viewmodel

import androidx.lifecycle.MutableLiveData
import com.baozhun.mall.common.model.bean.ExpressInfoBean
import com.baozun.houji.order.network.orderApiService
import com.baozhun.mall.common.model.bean.OrderDetailBean
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request

/**
 * @Title：
 * @Description：
 * @Author：xing.luo
 * @Since：2022/11/20
 * @Version：1.0.0
 */
class OrderDetailViewModel : BaseViewModel() {
    var mOrderDetailBean = MutableLiveData<OrderDetailBean>()
    var mExpressInfoBean = MutableLiveData<ExpressInfoBean>()
    var mSurplusTime = MutableLiveData<Long>()

    fun requestData(orderNo: String) {
        request({ orderApiService.getOrderDetailData(orderNo) }, {
            mOrderDetailBean.value = it
        }, isShowDialog = false)
    }

    /**
     * 获取物流信息
     */
    fun getLogisticsInfo(orderNo: String) {
        request({ orderApiService.getLogisticsInfo(orderNo) }, {
            mExpressInfoBean.value = it
        }, isShowDialog = false)
    }
}